fix(docs): add SIWE domain validation to authentication examples#1553
Open
faisalnugroho wants to merge 1 commit into
Open
fix(docs): add SIWE domain validation to authentication examples#1553faisalnugroho wants to merge 1 commit into
faisalnugroho wants to merge 1 commit into
Conversation
Fixes base#1502 The backend verification examples only checked the cryptographic signature but not the SIWE message domain, making them vulnerable to cross-domain replay attacks. Changes: - Backend (Viem) example: Add parseSiweMessage and domain check - Express server example: Add parseSiweMessage import and domain check - Both examples now validate that the SIWE domain matches the expected host before accepting the signature This follows EIP-4361 requirements for domain validation.
Collaborator
🟡 Heimdall Review Status
|
Author
|
Hi! I'd love to get this PR reviewed when you have a moment. This PR addresses add SIWE domain validation to authentication examples. Happy to make any adjustments based on your feedback. Let me know if there's anything I can do to help move this forward. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1502
The backend verification examples in the authentication guide only checked the cryptographic signature but not the SIWE message domain, making them vulnerable to cross-domain replay attacks.
Problem
A valid SIWE signature created for
evil.comcould be submitted toyourapp.com's/auth/verifyendpoint and would pass verification, becauseverifyMessageonly checks the cryptographic signature — not whether the message was intended for this domain.Changes
Backend (Viem) example:
parseSiweMessageimport fromviem/siweExpress server example:
parseSiweMessageimportBoth examples now validate that the SIWE domain matches the expected host, following EIP-4361 requirements.